app.factory('monitorService', [ '$resource', function($resource) {
    return $resource( '/monitor/:action/:moduleName',{
        action : '@action',
        moduleName : "@moduleName"
    },{
        showStatus : {
            method : 'GET',
            isArray : false
        },
        showLogs : {
            method : 'GET',
            isArray : false
        },
        getAlarmContents : {
            method : 'GET',
            isArray : false
        },
        alarmConfirm : {
            method : 'POST',
            isArray : false
        },
        restart : {
            method : 'POST',
            isArray : false,
            interceptor:{
                response: function(response) {
                    if (response.headers("MYREDIRECT")) {
                        var win = window;
                        while (win != win.top) {
                            win = win.top;
                        }
                        $.fn.jqLoading("destroy");
                        message_alert('提示', '没有权限，不能执行重启操作', function () {
                            win.location.href = response.headers("CONTENTPATH");
                        });
                        return  null;
                    }
                    return response.resource;
                }
            }
        }
    });
} ]);
